/**
 * 
 */
package guice.command;

import guice.command.model.Movie;
import guice.command.model.MoviesDB;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * 
 */
public class GetMovieDetailsCommand implements ICommand<String, Movie> {

	private String title;

	private Object receiver;

	/*
	 * (non-Javadoc)
	 * 
	 * @see guice.command.ICommand#execute()
	 */
	@Override
	public Movie execute() throws IllegalStateException {
		if (null == title)
			throw new IllegalStateException();
		return MoviesDB.getMovie(title);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see guice.command.ICommand#setData(java.lang.Object)
	 */
	@Override
	public void setData(String data) {
		this.title = data;

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see guice.command.ICommand#setReceiver(guice.command.ICommandReceiver)
	 */
	@Override
	public void setReceiver(ICommandReceiver<String, Movie> receiver) {
		this.receiver = receiver;
	}

}
